<?php

/**
 * CaisseEmploye form base class.
 *
 * @method CaisseEmploye getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCaisseEmployeForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'id_caisse'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Caisse'), 'add_empty' => false)),
      'id_employe'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Employe'), 'add_empty' => false)),
      'date_cloture'  => new sfWidgetFormInputText(),
      'solde_depart'  => new sfWidgetFormInputText(),
      'solde_cloture' => new sfWidgetFormInputText(),
      'ecart'         => new sfWidgetFormInputText(),
      'created_at'    => new sfWidgetFormDateTime(),
      'updated_at'    => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'id_caisse'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Caisse'))),
      'id_employe'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Employe'))),
      'date_cloture'  => new sfValidatorPass(),
      'solde_depart'  => new sfValidatorNumber(array('required' => false)),
      'solde_cloture' => new sfValidatorNumber(array('required' => false)),
      'ecart'         => new sfValidatorNumber(array('required' => false)),
      'created_at'    => new sfValidatorDateTime(),
      'updated_at'    => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('caisse_employe[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'CaisseEmploye';
  }

}
